﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;

namespace HtmlMaker
{
    public class RemoteHandler
    {
        static void get()
        {
            TcpClient tcpClient = new TcpClient();
            tcpClient.Connect("127.0.0.1", 8000);
            NetworkStream clientStream = tcpClient.GetStream();

            byte[] message = new byte[4096];
            int bytesRead;
            bytesRead = 0;

            try
            {
                // Read up to 4096 bytes
                bytesRead = clientStream.Read(message, 0, 4096);
            }
            catch
            {
                /*a socket error has occured*/
            }

            //We have read the message.
            ASCIIEncoding encoder = new ASCIIEncoding();
            Console.WriteLine(encoder.GetString(message, 0, bytesRead));

            tcpClient.Close();
        }
    }
}
